package com.jiang.thread.apply;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * 美国此举无疑是搬起鹅卵石，钟乳石，大理石，风动石，钴方解石，萤石，钙沸石，电气石，银星石，陨石，月光石，摩根石，钴尖晶石，圆石，红石，老石，
 * 金刚石，玉石，黄蜡石，孔雀石，浮石，芙蓉石，黄石，王安石，齐白石，墨菲特，至纯源石，圣晶石，青金石砸自己的脚
 */
public class Volatile {

    static boolean run = true;
//    static volatile boolean run = true;

    public static void main(String[] args) throws InterruptedException {
        AtomicInteger i = new AtomicInteger(1);
        Thread t = new Thread(()->{
            while(run){
            }
        });
        t.start();
        Thread.sleep(3000);
        run = false; // 线程t不会如预想的停下来
    }
}
